/*
 * @Author: your name
 * @Date: 2020-12-23 16:56:39
 * @LastEditTime: 2020-12-23 17:19:43
 * @LastEditors: Please set LastEditors
 * @Description: 计算图表dom的宽高尺寸
 * @FilePath: \gitee-WeBi\js\zz\echarts_dom\calcDom.js
 */
(function(){
    window.ARF_calc_dom = {
        /**
         * @description: 页面内单个图表
         * @param {
         * *    id:  dom元素的id
         *      options:{
         *         cw: 增大或减小宽度(+,-) 
         *         ch: 增大或减小高度(+,-) 
         *      }
         * } 
         * @return {
         * * 返回该dom元素
         * }
         */
        calcSingle( id ){
            try {
                var obj = $("#"+id);
                var objParent = obj.parent();
                // --- 未传options参数，根据父级尺寸设置宽高
                obj.css({
                    "width":"100%",
                    "height":objParent.height()+"px"
                });
                return obj.get(0);
            } catch (error) {
                console.warn("---calcSingle出错啦---",error);
                return null;
            }
        }
    };
})();
